import { init, h } from 'snabbdom';
import style from 'snabbdom/modules/style';
import eventlisteners from 'snabbdom/modules/eventlisteners';

const patch = init([style, eventlisteners]);

let vnode = h(
  'div',
  {
    style: {
      backgroundColor: 'red',
    },
    on: {
      click: eventHandler,
    },
  },
  [h('h1', 'hello,Snabbdom')]
);

function eventHandler() {
  console.log('点一下');
}

const app = document.querySelector('#app');

patch(app, vnode);
